//
//  XYNewFeatureVC.swift
//  SinaWB_XY
//
//  Created by 小熊猫 on 15/10/11.
//  Copyright © 2015年 小熊猫. All rights reserved.
//

import UIKit

class XYNewFeatureVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        loadScrollView()
    }

    private func loadScrollView(){
        //使用自定义的scrollView进行初始化
        let scrollView = XYNewFeatureView(frame: UIScreen.mainScreen().bounds)
        
        scrollView.loadScrollView("new_feature", imageCount: 4)
       
        //把scrollView添加到view上
        view.addSubview(scrollView)
        
        //inputButton的点击事件
        scrollView.inputBlock={
            //点击进入微博,切换主window的根控制器
            let delegate = UIApplication.sharedApplication().delegate as! AppDelegate
            delegate.window?.rootViewController = delegate.defulVc()
        }
        
        //分享到微博按钮的点击事件
        scrollView.seletBlock = { (seleButton:UIButton) -> () in
            //分享按钮后期可能会有其他功能,单独抽出一个方法
            self.didClickSeleButton(seleButton)
      
        }
        
    }
    
    //实现分享按钮的点击事件
    @objc private func didClickSeleButton(seleButton:UIButton){
        seleButton.selected = !seleButton.selected
    }
}






